package com.guonl.service;

import com.guonl.exception.BusinessException;
import com.guonl.model.ResponseResult;
import org.springframework.stereotype.Service;

@Service
public class GuavaRetryService {

    public Boolean retry(Integer code) throws Exception {
        System.out.println("retry被调用了");
        if ( code == null || code == 0) {
            throw new BusinessException("调用失败，重试");
        }
        System.out.println("调用成功");
        return code > 0;
    }

    public ResponseResult retry2(Integer code) throws Exception {
        System.out.println("retry被调用了");
        if ( code == null || code == 0) {
            return ResponseResult.failed("调用失败，重试");
        }
        System.out.println("调用成功");
        return ResponseResult.ok(code);
    }


}
